<?php
/*
 *      default.php
 *   
 *      Copyright 2009 Michael Gyen <GyenMic@autartica.be>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
defined('_JEXEC') or die('Restricted access'); 
//include_once(JPATH_COMPONENT.DS.'includes'.DS.'companyheader.php');
include_once(JPATH_COMPONENT.DS.'includes'.DS.'autartiheader.php');
?>
<script type="text/javascript">
	function submitbutton(pressbutton) {
		var f = document.adminForm; 				
  		if (pressbutton == 'cancel') {
   			submitform( pressbutton );
    			return;
 		 }
		if(trim(f.position.value) == '') {
			alert("<?php echo JText::_( 'ALERT_MISSING_POSITION' );?>");
			f.position.focus();			
		}
		else if(trim(f.town.value) == '') {
			alert("<?php echo JText::_( 'ALERT_MISSING_TOWN' );?>");
			f.town.focus();
		}		
		else if(trim(f.profile.value) == '') {
			alert("<?php echo JText::_( 'ALERT_MISSING_PROFILE' );?>");
			f.profile.focus();
		}
		
		else if(trim(f.start.value) == '') {
			alert("<?php echo JText::_( 'ALERT_MISSING_START' );?>");
			f.start.focus();
		}
		else{
			submitform( pressbutton );
		}
	}
	function trim(str, chars) {
		return ltrim(rtrim(str, chars), chars);
	}
	function ltrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
	}
	function rtrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
	}
</script>
<?php 
	$today = date("Y-m-d H:i:s");

	$arr = array();			
   foreach ($this->countries as $country){	  	
  	 $arr[] = JHTML::_('select.option', $country->id, JText::_($country->name) );   	
  }
  ?>
<form action="index.php" method="post" name="adminForm" id="adminForm" >
<div>
<fieldset class="adminform">
	<legend><?php echo JText::_( 'DETAILS' ); ?></legend>
	<table class="admintable" style="width:50%;">	
	
	<tr>
		<td colspan="3" style="text-align:right;" class="key"><span style="color:red;">*</span> <?php echo JText::_( 'FIELDS_MANDATORY' ); ?></td>
	</tr>
	<tr>
		<td width="120" class="key">
		<?php echo JText::_( 'PUBLISHED' ); ?>:
		</td>
		<td>
		<?php echo JHTML::_( 'select.booleanlist', 'published', 'class="inputbox"', $this->autartijob->published ); ?>
		</td>
	</tr>
	<tr>	<td class="key"><?php echo JText::_( 'POSITION' ); ?>:<span style="color:red;">*</span></td>
		<td colspan="2"><input name="position" id="position" type="text" style="width:100%;" maxlength="255"  value="<?php echo $this->autartijob->position; ?>" /></td>
	</tr>
	<tr>
		<td class="key"><?php echo JText::_( 'TOWN' ); ?>:<span style="color:red;">*</span></td>
		<td colspan="2"><input name="town" id="town" style="width:100%;" type="text" maxlength="255" value="<?php echo $this->autartijob->town; ?>" /></td>
	</tr>
	<tr>
		<td class="key"><?php echo JText::_( 'COUNTRY' ); ?>:<span style="color:red;">*</span></td>
		<td colspan="2"> 
			 <?php echo JHTML::_('select.genericlist', $arr, 'country_id', null, 'value', 'text', $this->autartijob->country_id);?>
		</td>
	</tr>	
	<tr>	
		<td colspan="3" class="key" style="text-align:left;"><?php echo JText::_( 'PROFILE' ); ?>:<span style="color:red;">*</span></td>
	</tr>
	<tr>
		<td colspan="3">
			<textarea name="profile" id="profile" style="width:100%;height:150px;"><?php echo $this->autartijob->profile; ?></textarea>
		</td>
	</tr>
	<tr>
		<td class="key"><?php echo JText::_( 'START' ); ?>:</td>
		<td colspan="2"><input name="start" id="start" type="text" maxlength="255" style="width:100%;" value="<?php echo $this->autartijob->start; ?>" /></td>
	</tr>
	<tr>
		<td class="key"><?php echo JText::_( 'SALARY' ); ?>:</td>
		<td><input name="salary" id="salary" type="text" maxlength="255" style="width:100%;" value="<?php echo $this->autartijob->salary; ?>" /></td>
	</tr>
	<tr>	
		<td colspan="3" class="key" style="text-align:left;"><?php echo JText::_( 'BENEFITS' ); ?>:</td>
	</tr>
	<tr>
		<td colspan="3">
			<textarea name="benefits" id="benefits" style="width:100%;height:150px;"><?php echo $this->autartijob->benefits; ?></textarea>
		</td>
	</tr>
	<tr>	
		<td colspan="3" class="key" style="text-align:left;"><?php echo JText::_( 'OTHER' ); ?>:</td>
	</tr>
	<tr>
		<td colspan="3">
			<textarea name="other" id="other" style="width:100%;height:150px;"><?php echo $this->autartijob->other; ?></textarea>
		</td>
	</tr>
	</table>
				

<div class="clr"></div>
<div class="clr"></div>	
<input type="hidden" name="option" value="com_autartijobs" />
<input type="hidden" name="id" value="<?php echo $this->autartijob->id; ?>" />
<input type="hidden" name="last_updated" value="<?php echo $today; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="autartijob" />			
</fieldset>
</div>
</form>
<?php include_once(JPATH_COMPONENT.DS.'includes'.DS.'autartifooter.php');?>


